From: Daniel Boles Date: Mon, 28 Aug 2017 20:56:06 +0000 (+0100) Subject: TextView: Fix gesture coords with :border-width >0 X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~281 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=bd7c87c762c75bbb8dfb5fed23964651188ef206;p=gtk%2B3.0.git TextView: Fix gesture coords with :border-width >0 Container:border-width caused the x/y coords converted to iters to be offset inwards by that width, breaking positioning/selecting by gesture. So, subtract :border-width in widget_to_text_window_coords(). This fixes gesture positions, & plays fine with :margin & CSS margin/border/padding N.B.: This is not to endorse :border-width. It’s gone in GTK+ 4 & weird on a TextView: it’d be more intuitive to – if you must! – set it on the TV parent. Really, please just use CSS instead. Still, it’s easy to fix. https://bugzilla.gnome.org/show_bug.cgi?id=759725 --- diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index c40ac2e67c..f267c6c02d 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5083,6 +5083,10 @@ _widget_to_text_window_coords (GtkTextView *text_view, gint *y) { GtkTextViewPrivate *priv = text_view->priv; + gint border_width = gtk_container_get_border_width (GTK_CONTAINER (text_view)); + + *x -= border_width; + *y -= border_width; if (priv->top_window) (*y) -= priv->top_window->requisition.height;